home *** CD-ROM | disk | FTP | other *** search
- *>b:DignetNoFree
-
- *«««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««*
- * Copyright © 1997 by Kenneth C. Nilsen. E-Mail: kennecni@IDGonline.no *
- * Source viewed in 800x600 with Thin711.font (11) in CED *
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- *
- * Name
- * DignetNoFree 1.0
- *
- * Synopsis
- * Demo program for dignet.library to show the resource tracking capability.
- *
- * Inputs
- * DignetNoFree <device> [unit] unit defaults to 0 if not provided
- *
- * Notes
- *
- * Bugs
- *
- * Created : 12.03.97
- * Changes : 12.03.97
- *««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««*
-
-
- StartSkip = 0
-
- ;DODUMP SET 1
-
-
- Incdir ""
-
- include lvo:exec_lib.i
- include lvo:dos_lib.i
- include lvo:dignet_lib.i
-
- Incdir inc:
-
- ;these two files are included:
-
- include digital.macs
- include startup.asm
-
- Incdir ""
-
- dc.b "$VER: DignetNoFree 1.0 (12.3.97)",10
- dc.b "Copyright © 1997 Digital Surface. PUBLIC DOMAIN",0
- even
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- Init TaskName "DignetNoFree resource tracking demo"
- DefLib dignet,2 ;version 2 of dignet.library
- DefLib dos,37 ;version 37 of dos.library
- DefEnd
-
- Start NextArg ;any args for this program ?
- beq About ;none, show About/usage
- move.l d0,a0
- cmp.b #'?',(a0) ;info wanted ? show About/Usage
- beq About
-
- lea DevN(pc),a1 ;we asume a device name
-
- .copyDevice
- move.b (a0)+,(a1)+ ;copy name to our own buffer
- bne.b .copyDevice ;you could easily default this to serial.device
-
- NextArg ;unit provided ?
- beq .noUnit ;if no unit provided, default to 0
-
- move.l d0,a0 ;this is just a demo so we take a simple convert
- move.b (a0),d0
- ext.w d0
- ext.l d0
- sub.w #48,d0 ;simple convert
- move.l d0,Unit
-
- .noUnit
- LibBase dignet
-
- lea DevN(pc),a0 ;device we want to use
- move.l Unit(pc),d0 ;unit
- Call AllocNet ;alloc a net structure
- move.l d0,Net ;ok, it's ready for use
- beq ErrorNet
-
- *------------------------------------------------------------------------------------------------------------*
- Close Return 0 ;quit program with 0 in return code
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- ErrorNet
- LibBase exec ;report error on device/unit
- lea NoNetTxt(pc),a0
- lea Table(pc),a1
- move.l #DevN,(a1)
- move.l Unit(pc),4(a1)
- lea Proc(pc),a2
- lea Buffer(pc),a3
- Call RawDoFmt
-
- lea Buffer(pc),a0
- bsr Print
- bra Close
-
- About lea AboutTxt(pc),a0 ;About/Usage message
- bsr Print
- bra Close
-
- Print movem.l d0-a6,-(sp) ;our sub routine that prints to def. out
-
- LibBase dos
- move.l a0,d2 ;backup string ptr.
- Call Output ;get def. outhandler
- move.l d0,d1
- beq .exit ;null ? then exit
-
- move.l d2,a0 ;start count of length of string
- moveq.l #0,d3 ;length
- .count tst.b (a0)+ ;a null termination ?
- beq.b .print ;yep, print
- addq.l #1,d3 ;no, add one more char
- bra.b .count ;loop
- .print Call Write ;write string to def Out which is our console
-
- .exit movem.l (sp)+,d0-a6
- rts
-
- Proc move.b d0,(a3)+
- rts
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- Net dc.l 0 ;ptr. to net structure
- Table dc.l 0,0 ;ptr. table for RawDoFmt()
-
- Unit dc.l 0 ;unit number
- DevN dcb.b 80,0 ;device name, insert "serial.device" in beginning to def. to that
-
- Buffer dcb.b 200,0 ;buffer for chars and RawDoFmt()
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- NoNetTxt dc.b "Couldn't open %s unit %ld!",10,10,0
- AboutTxt dc.b "DignetNoFree 1.0 resource tracking demo program for dignet.library",10,10
- dc.b "USAGE: DignetNoFree <device> <unit>",10,10,0
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
-